function validName = convert2ValidVariable(s)
  % Convert an invalid variable name into a valid one 
  % simply by removing all the invalid characters
  %
  % Author: David Goldsmith, Wash. State Dept. of Ecology, dgol461@ecy.wa.gov
  % Release date: 9/15/2011
  
    s = strtrim(s);
    while ~isstrprop(s(1), 'alpha') % while the first character is not alphabetic
        s = s(2:end); % dispose of it
    end
    validName = s(1);
  % Now, for the remaining characters, make sure they're alphanumeric
    for c = s(2:end) % for each character, except the first, in string s 
        if isstrprop(c, 'alphanum')
            validName(end+1) = c;
        end
    end
end